import { isUndefined, isNull } from 'lodash-es';
export { NOOP, isFunction, isString, isArray, isMap, isObject } from '@vue/shared';

export { isNull, isEmpty, isNumber, isBoolean, isEqual, isUndefined, upperFirst } from 'lodash-es';

export const isClient = () => typeof window !== 'undefined';
export const isWindow = val =>
  typeof window !== 'undefined' && toString.call(val) === '[object Window]';

export const is = (val, type) => {
  return toString.call(val) === `[object ${type}]`;
};

export const isUrl = path => {
  const reg =
    /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
  return reg.test(path);
};

export const isDefined = val => !isUndefined(val);

export const isNullOrUndefined = val => isUndefined(val) || isNull(val);
